home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / XLisp-Stat / Book / resize.lsp < prev    next >
Text File  |  1990-10-11  |  737b  |  25 lines

  1. ; book pp.247-248
  2.  
  3. (setf w (send graph-window-proto :new))
  4. (send w :draw-symbol 'disk t (/ (send w :canvas-width) 2) (/ (send w :canvas-height) 2))
  5.  
  6. (send w :add-slot 'x (/ (send w :canvas-width) 2))
  7. (send w :add-slot 'y (/ (send w :canvas-height) 2))
  8.  
  9. (defmeth w :x (&optional (val nil set))
  10.   (if set (setf (slot-value 'x) val))
  11.   (slot-value 'x))
  12. (defmeth w :y (&optional (val nil set))
  13.   (if set (setf (slot-value 'y) val))
  14.   (slot-value 'y))
  15.  
  16. (defmeth w :resize ()
  17.   (send self :x (/ (send self :canvas-width) 2))
  18.   (send self :y (/ (send self :canvas-height) 2)))
  19.  
  20. (defmeth w :redraw ()
  21.   (let ((x (round (send self :x)))
  22.         (y (round (send self :y))))
  23.     (send self :erase-window)
  24.     (send self :draw-symbol 'disk t x y)))
  25.